package com.game.gui {
	import com.game.data.Data;
	import com.game.utils.TowerType;
	
	import flash.display.Shape;
	import flash.filters.GlowFilter;
	import flash.geom.Matrix;
	public class TowerTempDrawShape extends Shape {
		private var _type:TowerType = TowerType.NONE;
		public function TowerTempDrawShape() {
			super();
			this.alpha = 0.5;
		}
		public function fillDrawShape(type:TowerType):void {
			_type = type;
			//trace(_type);
			clearShape();
			this.graphics.lineStyle(2, 0xffffff, 1);
			this.graphics.beginBitmapFill(Data.getInstance().weaponAnimArray[_type.ordinal][0], new Matrix(1, 0, 0, 1,-Data.IMAGE_PADDING/2,-Data.IMAGE_PADDING/2), false)
			this.graphics.drawCircle(Data.STEP / 2, Data.STEP / 2, Data.getInstance().weapons[_type.ordinal].range * Data.STEP );
			this.graphics.endFill();
		}
		public function allowFilter(allow:Boolean):void {
			if (allow) {
				this.filters = [new GlowFilter(0xff0000, 1, 8, 8, 2, 1, true), new GlowFilter()]
			} else {
				this.filters = [];
			}
		}
		public function clearShape():void {
			this.graphics.clear();
			this.filters = [];
		}
		public function get type():TowerType {
			return _type;
		}
		public function set type(value:TowerType):void {
			_type = value;
		}
	}
}